<?php

namespace App\Weixin\Providers;

use App\Weixin\Contracts\UserInterface;
use App\Weixin\Contracts\WithdrawInterface;
use App\Weixin\Repositories\DbUserRepositories;
use App\Weixin\Repositories\DbWithdrawRepositories;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;

class WeixinServiceProvider extends ServiceProvider
{

    protected $admin_namespace = 'App\Weixin\Controllers\Admin';
    protected $home_namespace = 'App\Weixin\Controllers\Home';
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //后台管理
        Route::middleware('web')
            ->namespace($this->admin_namespace)
            ->group(__DIR__."/../admin_routes.php");
        //前台管理
        Route::middleware('web')
            ->namespace($this->home_namespace)
            ->group(__DIR__."/../routes.php");
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(UserInterface::class, DbUserRepositories::class); //微信用户
        $this->app->bind(WithdrawInterface::class, DbWithdrawRepositories::class); //用户提现
    }
}
